package gov.dhs.cis.soa.data;

import gov.dhs.cis.soa.Constants;
import gov.dhs.cis.soa.Utils;
import gov.dhs.cis.soa.Constants.EntityType;


public class Rule extends AbstractSOAData {
	public static final String STEREO_TYPE = "Rule";

	public int id;
	public String name;
	public String maturity = "-1";
	public String descTxt;

	public Description desc;

	@Override
	public String toString() {
		return "Rule [id=" + id + ", name=" + name + "]";
	}
	
	@Override
	public boolean equals(Object obj) {
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Rule other = (Rule) obj;
		if (name.equalsIgnoreCase(other.name))
			return true;
		return false;
	}
	
	public void createDescription() {
		StringBuffer txt = new StringBuffer();
		if(Utils.isEmpty(descTxt))
			descTxt = "";
		txt.append(Constants.NL+descTxt);

		desc = Utils.prepareDescObj(txt.toString(), EntityType.RULE);
	}
 
//	public static String getUMLId(int entityId) {
//		return EntityType.SOPER + "_" + entityId;
//	}
	
	@Override
	public long getId() {
		return id;
	}
	@Override
	public String getHashableId() {
		return name;
	}
	
	@Override
	public EntityType getUMLType() {
		return EntityType.RULE;
	}
}
